import 'package:flutter/material.dart';
import '/components/page/common.dart';
import '/utils/setting.dart';
import '/components/list/route_menu_item.dart';
import './widgets/user_info_top.dart';

class MinePage extends StatelessWidget {
  const MinePage({super.key});

  @override
  Widget build(BuildContext context) {
    return CommonPage(
      appBarBgColor: Colors.white,
      child: Container(
        color: DefaultColor.primary,
        child: const MineWidget(),
      ),
    );
  }
}

// 我的 -组件
class MineWidget extends StatelessWidget {
  const MineWidget({super.key});

  @override
  Widget build(BuildContext context) {
    List listData = [
      {
        'title': '服务',
        'leftImgPath': 'assets/tabBar/mine/ic_wallet.png',
        'onTap': () {
          Navigator.pushNamed(context, 'ServicePage');
        }
      },
      {
        'title': '收藏',
        'leftImgPath': 'assets/tabBar/mine/ic_collections.png',
        'hasBottom': false,
        'onTap': () {
          Navigator.pushNamed(context, 'CollectPage');
        }
      },
      {
        'title': '朋友圈',
        'leftImgPath': 'assets/tabBar/mine/ic_album.png',
        'hasBottom': false,
        'onTap': () {
          Navigator.pushNamed(context, 'AlbumPage');
        }
      },
      {
        'title': '视频号',
        'leftImgPath': 'assets/tabBar/mine/ic_videoAccount.png',
        'hasBottom': false,
        'onTap': () {
          Navigator.pushNamed(context, 'VideoAccountPage');
        }
      },
      {
        'title': '卡包',
        'leftImgPath': 'assets/tabBar/mine/ic_cards_wallet.png',
        'hasBottom': false,
        'onTap': () {
          Navigator.pushNamed(context, 'CardsBagPage');
        }
      },
      {
        'title': '表情',
        'leftImgPath': 'assets/tabBar/mine/ic_emotions.png',
        'onTap': () {
          Navigator.pushNamed(context, 'EmotePage');
        }
      },
      {
        'title': '设置',
        'leftImgPath': 'assets/tabBar/mine/ic_settings.png',
        'onTap': () {
          Navigator.pushNamed(context, 'SettingPage');
        }
      },
    ];
    return Column(
      children: [
        const UserAvatarInfoWidget(),
        const SizedBox(height: 10),
        Column(
            children: listData.map((item) => RouteMenuItem(
              leftImgPath: item['leftImgPath'],
              title: item['title'],
              hasBottom: item['hasBottom'] ?? true,
              rightText: item['rightText'],
              onTap: item['onTap'],
            )).toList()
        ),
      ],
    );
  }
}
